package com.edu.buservice.dal.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.edu.buservice.dal.mapper.SysRolesMapper;
import com.edu.buservice.dal.model.SysRoles;
import com.edu.buservice.dal.service.SysRolesService;
import com.edu.buservice.util.model.enums.ErrorCodeEnum;
import com.edu.buservice.util.model.error.BizException;
import org.springframework.stereotype.Service;

/**
 * @author 86177
 * @description 针对表【sys_roles(角色信息表)】的数据库操作Service实现
 * @createDate 2025-02-05 23:34:05
 */
@Service
public class SysRolesServiceImpl extends ServiceImpl<SysRolesMapper, SysRoles>
		implements SysRolesService{

	@Override
	public SysRoles getRolesById(String id) {

		if(StrUtil.isBlank(id)){
			throw new BizException(ErrorCodeEnum.PARAM_ERROR,"角色id不能为null");
		}

		LambdaQueryWrapper<SysRoles> queryWrapper = new LambdaQueryWrapper<>();
		queryWrapper.eq(SysRoles::getId,id);
		queryWrapper.eq(SysRoles::getDeleted,0);
		return getOne(queryWrapper);

	}
}




